﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc.Html;
using System.Web.Mvc;
using System.IO;

namespace Simple.Web.Framework.Infrastructure.UI
{
    public static class HtmlHelperExtensions
    {
        public class HBootstrapDivContainer : IDisposable
        {
            private readonly TextWriter _writer;
            public HBootstrapDivContainer(TextWriter writer)
            {
                _writer = writer;
            }

            public void Dispose()
            {
                _writer.Write("</div></div>");
            }
        }

        public static IDisposable BeginHBootstrap_Box(this HtmlHelper htmlHelper, string title)
        {
            var writer = htmlHelper.ViewContext.Writer;
            writer.WriteLine(string.Format("<div class=\"ibox\"><div class=\"ibox-title\"><h5>{0}</h5></div><div class=\"ibox-content\">", title));
            //writer.WriteLine(string.Format("<div class=\"panel panel-default\"><div class=\"panel-heading\"><h5>{0}</h5></div><div class=\"panel-body\">",title));
            return new HBootstrapDivContainer(writer);
        }
    }
}